import 'package:citiesocial/beans/goods_entity.dart';

class GoodsDetailEntity {
  String goods_id,
      goods_brand,
      goods_name,
      origin_price,
      goods_price,
      finish_time,
      is_focus,
      goods_desc;
  List<String> goods_img;
  List<GoodsEntity> recommended_goods;

  GoodsDetailEntity.fromJson(dynamic json) {
    if (json != null && json is Map) {
      goods_id = json['goods_id'];
      goods_brand = json['goods_brand'];
      goods_name = json['goods_name'];
      origin_price = json['origin_price'];
      goods_price = json['goods_price'];
      finish_time = json['finish_time'];
      is_focus = json['is_focus'];
      goods_desc = json['goods_desc'];
      //images
      final imgs = json['goods_img'] ?? [];
      goods_img = List();
      for (dynamic i in imgs) {
        goods_img.add('$i');
      }
      //goods
      var goods = json['recommended_goods'] as List ?? [];
      recommended_goods = List();
      for (dynamic g in goods) {
        recommended_goods.add(GoodsEntity.fromJson(g));
      }
    }
  }
}
